<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/7/15
 * Time: 23:33
 */

namespace app\lib\exception;

use think\Exception;

class BaseException extends Exception
{
    public $code = 400;
    public $msg = '参数错误！';
    //自定义错误码
    public $errorCode = 10000;
    //构造函数
    public function __construct($paramers = [])
    {
        if(!is_array($paramers)) {
            throw new Exception('参数必须为数组！');
        }
        if(array_key_exists('code', $paramers))  $this -> code = $paramers['code'];
        if(array_key_exists('msg', $paramers))  $this -> msg = $paramers['msg'];
        if(array_key_exists('errorCode', $paramers))  $this -> errorCode = $paramers['errorCode'];
    }
}